<?php

App::uses('Shell', 'Console');
App::uses('PsfmAdmin', 'Lib');

class CacheShell extends AppShell {

    public function getOptionParser() {
        $parser = parent::getOptionParser();
        $parser->addSubcommand("clear");
        $parser->addSubcommand("update");
        return $parser;
    }

    public function clear() {
        PsfmAdmin::customDataModelsClearCache();
    }
    
    public function update() {
        PsfmAdmin::customDataModelsClearCache();
        
        
        foreach (array('RawFile', 'SourceDocument', 'SourceDocumentTag', 'Tag', 'RawFileTag') as $model) {
            ClassRegistry::init($model)->assertInitializedData();
        }
    }

}
